package com.wangjiacai.hqlQuery.hql.condition.where;

import com.wangjiacai.hqlQuery.hql.condition.Condition;

import java.lang.annotation.*;

@Target({ElementType.FIELD})
@Retention(RetentionPolicy.RUNTIME)
@Condition(condition = Null.NullCondition.class,column = Null.NullCondition.class)
public @interface Null {

    String column() default "";

    class NullCondition implements Condition.Where, Condition.Column<Null> {
        @Override
        public String where(Annotation notNull,String property, String column,Object obj, Object value) {
            return column+" is null ";
        }

        @Override
        public String column(Null aNull, String property) {
            return aNull.column().equals("")?property:aNull.column();
        }
    }
}
